package com.tanhua.server.service;

import com.tanhua.dubbo.api.FriendApi;
import com.tanhua.server.interceptor.UserHolder;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

@Service
public class FriendService {
    @Reference
    private FriendApi friendApi;

    public ResponseEntity<Object> love(Long friendId) {
        Long userId = UserHolder.getUserId();
        friendApi.addLike(userId,friendId);

        return ResponseEntity.ok(null);
    }


    public ResponseEntity<Object> unlove(Long friendId) {
        Long userId = UserHolder.getUserId();
        friendApi.deleteLike(userId,friendId);

        return ResponseEntity.ok(null);    }
}
